package cn.learn.athena.service.impl;

import cn.learn.athena.dao.UserDao;
import cn.learn.athena.model.User;
import cn.learn.athena.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author zlj
 * @Date 2018/10/29
 * @des
 */

@Service
public class UserServiceImpl implements IUserService {

    @Resource
    private UserDao userDao ;

    @Override
    public int addUser(User user) {
        user.setLevelId(1);
        user.setNickName("");
        return userDao.addObject(user);
    }

    @Override
    public User findUserByLoginNameAndPassword(String loginName, String password) {
        return userDao.findUserByLoginNameAndPassword(loginName,password);
    }

    @Override
    public User findUserByLoginName(String loginName) {
        return userDao.findUserByLoginName(loginName);
    }

    @Override
    public User findUserById(Integer id) {
        return userDao.queryById(id);
    }
}
